package cn.toolck.login_demo.service.impl;

import cn.toolck.login_demo.pojo.User;
import cn.toolck.login_demo.service.LoginService;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * @ClassName LoginServiceImpl
 * @Description 登录
 * @Author Toolck Rin
 * @Date 2021/3/23 21:15
 * @Version 1.0
 **/
@Service
public class LoginServiceImpl implements LoginService {

    @Override
    public boolean login(User user, HttpSession session) {
        User result = null;
        if ("admin".equals(user.getUsername()) && "admin".equals(user.getPassword())) {
            result = user;
        }
        session.setAttribute("user", user.getUsername());
        return result != null;
    }
}
